﻿<!--
<copyright company="Christoph van der Fecht - VDsoft">
This code can be used in commercial, free and open source projects.
</copyright>
-->
<Window x:Class="VDsoft.SeriesNewsReader.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="{Binding Path=Title}" 
		Height="400" 
		Width="900"
		DataContext="{Binding Path=MainView, Source={StaticResource Locator}}" 
		Icon="icon.ico">
    
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Styles/VDsoftStyles.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
    
    <Grid>
		<Grid.RowDefinitions>
			<RowDefinition Height="20"/>
			<RowDefinition Height="20*"/>
		</Grid.RowDefinitions>
        
		<!--Menu-->
		<Menu Grid.Row="0">
			<MenuItem Header="File">
				<MenuItem Header="Exit"/>
			</MenuItem>
			<MenuItem Header="Filters"
					  x:Name="menuItemFilters">
				<MenuItem.ItemContainerStyle>
					<Style TargetType="MenuItem">
						<!--<Setter Property="Header" Value="{Binding}"/>-->
						<Setter Property="Command"	Value="{Binding Path=MainView.ApplySeriesFilterCommand, Source={StaticResource ResourceKey=Locator}}"/>
						<Setter Property="CommandParameter" Value="{Binding Header, RelativeSource={RelativeSource Self}}"/>
					</Style>
				</MenuItem.ItemContainerStyle>
			</MenuItem>
			<MenuItem Header="Tools">
				<MenuItem Header="Settings"
						  Command="{Binding Path=ShowOptionsCommand}"/>
			</MenuItem>
			<MenuItem Header="Help">
				<MenuItem Header="About"
						  Command="{Binding Path=ShowAboutDialogCommand}"/>
			</MenuItem>
		</Menu>
		
		<!--Content-->
		<Grid Grid.Row="1">
			<Grid.RowDefinitions>
				<RowDefinition Height="35"/>
				<RowDefinition Height="17*"/>
			</Grid.RowDefinitions>
			<!--Language and resolution filter-->
			<StackPanel Grid.Row="0"
						Orientation="Horizontal">
				<!--Language selector-->
				<StackPanel Orientation="Horizontal">
					<TextBlock Text="Language:"
							   Margin="5,9,5,0"/>
					<ComboBox Margin="5"
							  MinWidth="100"
							  VerticalAlignment="Top"
							  ItemsSource="{Binding Path=Languages, Mode=OneWay}"
							  SelectedItem="{Binding Path=SelectedLanguage, Mode=TwoWay}">
					</ComboBox>
				</StackPanel>
				<!--Resolution filters-->
				<StackPanel Orientation="Horizontal">
					<CheckBox Content="720p"
							  IsChecked="{Binding Path=FilterHdReady, Mode=TwoWay}"
							  Margin="5,9,5,0"
                              Style="{StaticResource ResourceKey=DrawnCheckBox}"/>
					<CheckBox Content="1080p"
							  IsChecked="{Binding Path=FilterFullHd, Mode=TwoWay}"
							  Margin="5,9,5,0"
                              Style="{StaticResource ResourceKey=DrawnCheckBox}"/>
				</StackPanel>
			</StackPanel>
			<!--List-->
			<DockPanel Grid.Row="1"
					   Margin="1">
				<DataGrid ItemsSource="{Binding Path=Series, Mode=OneWay}"
						  CanUserReorderColumns="True"
						  AlternatingRowBackground="LightGray"
						  AlternationCount="2"
						  AutoGenerateColumns="False">
					<DataGrid.Columns>
						<DataGridTextColumn Header="Language"
											Binding="{Binding Path=Language}"
											IsReadOnly="True"/>
						<DataGridTextColumn Header="Title"
											Binding="{Binding Path=Title}"
											IsReadOnly="True"/>
						<DataGridHyperlinkColumn Header="Link"
												 Binding="{Binding Path=Link}"
												 IsReadOnly="True"
												 CanUserSort="False">
							<DataGridHyperlinkColumn.ElementStyle>
								<Style TargetType="TextBlock">
									<EventSetter Event="Hyperlink.Click" Handler="OnHyperlinkClick"/>
								</Style>
							</DataGridHyperlinkColumn.ElementStyle>
						</DataGridHyperlinkColumn>
					</DataGrid.Columns>
				</DataGrid>
			</DockPanel>
		</Grid>
    </Grid>
</Window>
